package com.mstore.service;

import java.util.ArrayList;
import java.util.List;

import com.mstore.dao.BWeixinurlDao;
import com.mstore.pojo.BWeixinurl;

public class BWeixinurlService {

	private BWeixinurlDao bWeixinurlDao;

	/**
	 * 通过id查询一条微信跳转url信息
	 */
	public BWeixinurl getWeixinurlById(BWeixinurl bWeixinurl) {
		Object object = bWeixinurlDao.getWeixinurlById(bWeixinurl);
		if (object == null) {
			return null;
		}
		return (BWeixinurl) object;
	}

	/**
	 * 查询全部微信跳转url
	 */
	public List<BWeixinurl> getWeixinurl() {
		List<Object> objects = bWeixinurlDao.getWeixinurl();
		List<BWeixinurl> bWeixinurls = new ArrayList<BWeixinurl>();
		for (Object object : objects) {
			bWeixinurls.add((BWeixinurl) object);
		}
		return bWeixinurls;
	}

	/**
	 * 查询企业的url
	 */
	public List<BWeixinurl> getWeixinurlByEaId(Long eaId) {
		List<Object> objects = bWeixinurlDao.getWeixinurlByEaId(eaId);
		List<BWeixinurl> bWeixinurls = new ArrayList<BWeixinurl>();
		for (Object object : objects) {
			bWeixinurls.add((BWeixinurl) object);
		}
		return bWeixinurls;
	}

	/**
	 * 保存新链接
	 */
	public void addWeixinUrl(BWeixinurl bWeixinurl) {
		bWeixinurlDao.addWeixinUrl(bWeixinurl);
	}

	/**
	 * 删除链接
	 */
	public void delWeixinUrl(BWeixinurl bWeixinurl) {
		bWeixinurlDao.delWeixinUrl(bWeixinurl);
	}

	/**
	 * 修改链接
	 */
	public void modifyWeixinUrl(BWeixinurl bWeixinurl) {
		bWeixinurlDao.modifyWeixinUrl(bWeixinurl);
	}

	/**
	 * 菜单查询企业url
	 */
	public List<BWeixinurl> getWeixinMenuUrlByEaId(Long eaId) {
		List<Object> objects = bWeixinurlDao.getWeixinMenuUrlByEaId(eaId);
		List<BWeixinurl> bWeixinurls = new ArrayList<BWeixinurl>();
		for (Object object : objects) {
			bWeixinurls.add((BWeixinurl) object);
		}
		return bWeixinurls;
	}

	public BWeixinurlDao getbWeixinurlDao() {
		return bWeixinurlDao;
	}

	public void setbWeixinurlDao(BWeixinurlDao bWeixinurlDao) {
		this.bWeixinurlDao = bWeixinurlDao;
	}

}
